var o, e = require, t = module, n = exports, i = this && this.__extends || (o = function(t, e) {
    return (o = Object.setPrototypeOf || {
        __proto__: []
    } instanceof Array && function(t, e) {
        t.__proto__ = e;
    } || function(t, e) {
        for (var o in e) e.hasOwnProperty(o) && (t[o] = e[o]);
    })(t, e);
}, function(t, e) {
    function n() {
        this.constructor = t;
    }
    o(t, e), t.prototype = null === e ? Object.create(e) : (n.prototype = e.prototype, 
    new n());
}), a = this && this.__decorate || function(t, e, o, n) {
    var r, a = arguments.length, i = a < 3 ? e : null === n ? n = Object.getOwnPropertyDescriptor(e, o) : n;
    if ("object" == typeof Reflect && "function" == typeof Reflect.decorate) i = Reflect.decorate(t, e, o, n); else for (var c = t.length - 1; 0 <= c; c--) (r = t[c]) && (i = (a < 3 ? r(i) : 3 < a ? r(e, o, i) : r(e, o)) || i);
    return 3 < a && i && Object.defineProperty(e, o, i), i;
};

Object.defineProperty(n, "__esModule", {
    value: !0
});

var r = e("ValueManager"), s = e("WebManager"), c = cc._decorator, l = c.ccclass, d = c.property, u = function(e) {
    function t() {
        var t = null !== e && e.apply(this, arguments) || this;
        return t.itemPrefab = null, t.sprite = null, t.types = "51,52,53,54", t.items = [], 
        t;
    }
    return i(t, e), t.prototype.onLoad = function() {
        for (var t = 0; t < 4; t++) {
            var e = cc.instantiate(this.itemPrefab);
            e.parent = this.node, this.items.push(e);
        }
    }, t.prototype.start = function() {
        var o = this, t = r.default.getInstance().getValue("daoliang" + this.types);
        t ? t.forEach(function(t, e) {
            o.node && o.node.children[e].getComponent("DaoliangItem").setInfo(t.data, t.type);
        }) : s.default.getInstance().redirectUnite({
            Type: this.types.split(","),
            success: function(t) {
                console.log("redirectUnite", t), 0 == t.data.code && (r.default.getInstance().setValue("daoliang" + o.types, t.data.data), 
                t.data.data.forEach(function(t, e) {
                    e < o.items.length && o.items[e].getComponent("DaoliangItem").setInfo(t.data, t.type);
                }));
            }
        });
    }, a([ d(cc.Prefab) ], t.prototype, "itemPrefab", void 0), a([ d(cc.Sprite) ], t.prototype, "sprite", void 0), 
    a([ d ], t.prototype, "types", void 0), a([ l ], t);
}(cc.Component);

n.default = u;